<?php
include "../../inc/inc.koneksi.php";

ini_set('display_errors', 1); ini_set('error_reporting', E_ERROR);

$username = $_POST['username'];
$password = $_POST['password'];

$sql    = mysql_query("SELECT * FROM users WHERE user_id= '" . $username . "'");
$row	= mysql_num_rows($sql);

if ($row > 0){

    echo json_encode(array('status' => 'FAIL', "message" => "User id <b>" . $username . "</b> sudah ada"));
        
} else {
    
    mysql_query("INSERT INTO users (user_id, password) VALUES('" . $username . "','" . md5($password) . "')");
    echo json_encode(array('status' => 'OK', "message" => "Data berhasil disimpan"));

}	

?>